%clc;clear all;
[num,txt,res]=xlsread('C:\Users\Administrator\Desktop\建模校赛\第二题数据.xlsx','B1:G35');
%num1=xlsread('C:\Users\Administrator\Desktop\工作簿1.xlsx','A2:B60')
%disp(res) 
%a=res
%disp(res(:,2))
u=num(:,1)
v=num(:,2)
t1=num(:,3)
t11=num(:,4)
q=num(:,5)
t=num(:,6)
ave=(q+t)/2
%scatter(t1,t11,'o')
xlabel('T1/K')
ylabel('T11/K') 
%plot(t1,t11,'-r')

multifun(u,v,q)
function [A ,B,C]=multifun(x1,x2,y) 
 a1 =sum(y.*x1); 
 a2=sum(x2.*y); 
 aa1=sum(x1.*x1);
 aa2=sum(x2.*x2);
 n=length(x1);
 d=sum(x1.*x2);
 b1=sum(x1);
 b2=sum(x2); 
 c=sum(y);
solve('a1-A*aa1-B*d-C*b1=0 ','a2-A*d-B*aa2-C*b2=0','c-A*b1-B*b2-n*C=0','A','B','C')
A=(a1*b2*b2 - a2*b1*b2 + aa2*b1*c - b2*c*d - a1*aa2*n + a2*d*n)/(aa2*b1^2 - 2*b1*b2*d + aa1*b2^2 + n*d^2 - aa1*aa2*n)
B = (a2*b1^2 - a1*b1*b2 + aa1*b2*c - b1*c*d - a2*aa1*n + a1*d*n)/(aa2*b1^2 - 2*b1*b2*d + aa1*b2^2 + n*d^2 - aa1*aa2*n)
C =(c*d^2 + a1*aa2*b1 + a2*aa1*b2 - aa1*aa2*c - a1*b2*d - a2*b1*d)/(aa2*b1^2 - 2*b1*b2*d + aa1*b2^2 + n*d^2 - aa1*aa2*n)

[a,b]=meshgrid(100:5:200,100:5:200);
f=A*a+B*b+C;
surf(a,b,f)
end
